package com.zxy.domain.config;

import com.zxy.domain.FileProperties;
import com.zxy.service.FileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Auther: lenovo
 * @Date: 2021/10/15 14:57
 * @Description:
 */
@Configuration
@EnableConfigurationProperties(FileProperties.class)
public class FileAutoConfiguration {

    @Autowired
    private FileProperties fileProperties;

    @Bean
    @ConditionalOnProperty(prefix = "file",value = "enable",havingValue = "true")
    public FileService fileService(){
        return new FileService(fileProperties);
    }

}
